package com.dotools.privacy;

import android.app.Activity;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;

import com.dotools.procommon.R;


public class PrivacyPolicyActivity extends Activity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_privacy);
        ApplicationInfo appInfo = null;
        String url = null;
        try {
            appInfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
            url = appInfo.metaData.getString("PRIVACY_CHANNEL_URL");
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            throw new NullPointerException("PrivacyPolicyActivity:没有找到Manifest中的PRIVACY_CHANNEL_URL值");
        }
        ImageView back = (ImageView) findViewById(R.id.ido_user_project_back);
        WebView webView = findViewById(R.id.privacy_webview);
        TextView title = findViewById(R.id.title);
        title.setText(getString(R.string.activity_about_privacy_policy_title));
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        webView.getSettings().setSavePassword(false);//明文密码漏洞配置
        webView.getSettings().setAllowFileAccess(false);//同源策略绕过
        webView.getSettings().setJavaScriptEnabled(false);//同源策略绕过
        webView.loadUrl(url);
    }


//    private String getPrivacyUrl() {
//        switch (getPackageName()) {
//            case "com.ibox.calculators":
//                return "http://wordpress.m1book.com/隐私声明-12";
//            case "com.ibox.calculators.split":
//                return "http://wordpress.m1book.com/隐私声明-87";
//            case "com.pocket.calculators":
//                return "http://wordpress.m1book.com/隐私声明-13";
//            case "com.dotools.weather":
//                return "http://wordpress.m1book.com/隐私声明-23";
//            case "com.ltt.compass":
//                return "http://wordpress.m1book.com/隐私声明-8";
//            case "com.syido.netradio":
//                return "http://wordpress.m1book.com/隐私声明-15";
//            case "com.readily.calculators":
//                return "http://wordpress.m1book.com/yinsi-ssdtsj";
//            case "com.qiongyou.compass":
//                return "http://wordpress.m1book.com/隐私声明-45";
//            case "com.iboxltt.flashlight":
//                return "http://wordpress.m1book.com/隐私声明-37";
//            case "com.dotools.note":
//                return "http://wordpress.m1book.com/隐私声明-29";
//            case "com.dotools.clock":
//                return "http://wordpress.m1book.com/隐私声明-22";
//            case "com.chacha.qrcode":
//                return "http://wordpress.m1book.com/隐私声明-53";
//            case "com.oeiskd.easysoftkey":
//                return "http://wordpress.m1book.com/隐私声明-36";
//            case "com.erciyuan.clock":
//                return "http://wordpress.m1book.com/隐私声明-40";
//            case "com.quna.compass":
//                return "http://wordpress.m1book.com/隐私声明-65";
//            case "com.syido.decibel":
//                return "http://wordpress.m1book.com/隐私声明-39";
//            case "com.idoconstellation":
//                return "http://wordpress.m1book.com/隐私声明-34";
//            case "com.sydo.perpetual.calendar":
//                return "http://wordpress.m1book.com/隐私声明-42";
//            case "com.syido.idotask":
//                return "http://wordpress.m1book.com/隐私声明-76";
//            case "com.syido.express":
//                return "http://wordpress.m1book.com/隐私声明-75";
//            case "com.fk.decibel":
//                return "http://wordpress.m1book.com/隐私声明-39";
//            case "com.syido.metaphysics":
//                return "http://wordpress.m1book.com/隐私声明";
//            case "com.syido.maestro":
//                return "http://wordpress.m1book.com/隐私声明-44";
//            case "com.sydo.subtitlesadded":
//                return "http://wordpress.m1book.com/yinsi-spjzm";
//            case "com.ido.compass":
//                return "http://wordpress.m1book.com/隐私声明-54";
//            case "com.one.click.ido.screenshot":
//                return "http://wordpress.m1book.com/隐私声明-20";
//            case "com.ejnet.weathercamera":
//                return "http://wordpress.m1book.com/隐私声明-32";
//            case "com.second.stepcount":
//                return "http://wordpress.m1book.com/隐私声明-74";
//            case "com.syd.stepcount":
//                return "http://wordpress.m1book.com/隐私声明-57";
//            case "com.sydo.idphoto":
//                return "http://wordpress.m1book.com/隐私声明-80";
//            case "com.almighty.calculators":
//                return "http://wordpress.m1book.com/隐私声明-60";
//            case "com.iodkols.onekeylockscreen":
//            case "com.orange.onekeylockscreen":
//            case "com.idofinger.lockscreen":
//                return "http://wordpress.m1book.com/隐私声明-9";
//            case "com.ido.oneclick.screenCutImg":
//                return "http://wordpress.m1book.com/隐私声明-52";
//            case "com.ido.oneclick.screenshotHelper":
//                return "http://wordpress.m1book.com/隐私声明-47";
//            case "com.sydo.longscreenshot":
//                return "http://wordpress.m1book.com/yinsi-gundongchangjieping";
//            case "com.syido.elementcalculators":
//                return "http://wordpress.m1book.com/隐私声明-64";
//            case "com.dotools.nightcamera":
//                return "http://wordpress.m1book.com/隐私声明-3";
//            case "com.syido.voicerecorder":
//                return "http://wordpress.m1book.com/隐私声明-48";
//            case "com.ido.screen.record":
//                return "http://wordpress.m1book.com/隐私声明-5";
//            case "com.ido.screen.record.expert":
//                return "http://wordpress.m1book.com/隐私声明-77";
//            case "com.ibox.flashlight":
//                return "http://wordpress.m1book.com/隐私声明-2";
//            case "com.idotools.qrcode":
//                return "http://wordpress.m1book.com/隐私声明-19";
//            case "com.master.onelockscreen":
//                return "http://wordpress.m1book.com/隐私声明-59";
//            case "com.ido.projection":
//                return "http://wordpress.m1book.com/隐私声明-4";
//            case "com.idostudy.mathematicss":
//                return "http://wordpress.m1book.com/隐私声明-86";
//            case "com.ido.barrage":
//                return "http://wordpress.m1book.com/隐私声明-6";
//            case "com.ido.ruler":
//                return "http://wordpress.m1book.com/隐私声明-41";
//            case "com.sydo.re.watermark":
//                return "http://wordpress.m1book.com/隐私声明-85";
//            case "com.idotools.rings":
//                return "http://wordpress.m1book.com/隐私声明-18";
//            case "com.syido.timer":
//                return "http://wordpress.m1book.com/隐私声明-79";
//            case "com.ido.eye.protection":
//                return "http://wordpress.m1book.com/隐私声明-89";
//            case "com.sydo.puzzle":
//                return "http://wordpress.m1book.com/隐私声明-92";
//            case "com.syido.marquee":
//                return "http://wordpress.m1book.com/隐私声明-93";
//            case "com.sydo.onekeygif":
//                return "http://wordpress.m1book.com/隐私声明-43";
//            case "com.idostudy.picturebook":
//                return "http://wordpress.m1book.com/隐私声明-95";
//            case "com.syour.rubbish":
//                return "http://wordpress.m1book.com/隐私声明-21";
//            case "com.syido.answer.wiki":
//                return "http://wordpress.m1book.com/隐私声明-96";
//            case "com.syid.measure":
//                return "http://wordpress.m1book.com/隐私声明-56";
//            case "com.parental.controler":
//                return "http://wordpress.m1book.com/隐私声明-16";
//            case "com.ido.shadow":
//                return "http://wordpress.m1book.com/隐私声明-50";
//            case "com.syido.fmod":
//                return "http://wordpress.m1book.com/隐私声明-25";
//            case "com.syido.rhythm":
//                return "http://wordpress.m1book.com/隐私声明-116";
//            case "com.idostudy.chengyu":
//                return "http://wordpress.m1book.com/隐私声明-121";
//            case "com.idostudy.babyw":
//                return "http://wordpress.m1book.com/隐私声明-122";
//            case "com.idostudy.shici":
//                return "http://wordpress.m1book.com/隐私声明-124";
//            case "com.syido.extractword":
//                return "http://wordpress.m1book.com/隐私声明-128";
//            case "com.sydo.audioextraction":
//                return "http://wordpress.m1book.com/yinsi-yptq";
//            case "com.ac.pbook":
//                return "http://wordpress.m1book.com/儿童绘本故事机隐私声明";
//            case "com.study.hanzi":
//                return "http://wordpress.m1book.com/yinsi-study-hanzi";
//            case "com.syido.idoreplaceicon":
//                return "http://wordpress.m1book.com/yinsisyido-idoreplaceicon";
//            case "com.qimeng.naoli":
//                return "http://wordpress.m1book.com/yinsi-qimeng-naoli";
//            case "com.diantai.youer":
//                return "http://wordpress.m1book.com/yinsidiantai-yourer";
//            case "com.rongyao.clock":
//                return "http://wordpress.m1book.com/隐私声明-51";
//            case "com.ido.watermark.camera":
//                return "http://wordpress.m1book.com/yinsi-sydk";
//            case "com.bookstory.renge":
//                return "http://wordpress.m1book.com/yinsirenge";
//            case "com.qimeng.math":
//                return "http://wordpress.m1book.com/yinsishuxue";
//            case "com.idostudy.enstory":
//                return "http://wordpress.m1book.com/yinsiyingwen";
//            case "com.idostudy.picture":
//                return "http://wordpress.m1book.com/yinsi-kantushiwu";
//            case "com.syido.weightpad":
//                return "http://wordpress.m1book.com/yinsi-tizhongdaka";
//            case "com.syido.changeicon":
//                return "http://wordpress.m1book.com/yinsi-tubiao";
//            case "com.idostudy.enword":
//                return "http://wordpress.m1book.com/yinsibbword";
//            case "com.syido.tips":
//                return "http://wordpress.m1book.com/yinsi-ls";
//            case "com.idostudy.chinese":
//                return "http://wordpress.m1book.com/yinsi-guoxue";
//            case "com.study.dizigui":
//                return "http://wordpress.m1book.com/yinsi-dizigui";
//            case "com.study.privatestudy":
//                return "http://wordpress.m1book.com/yinsi-syll";
//            case "com.sydo.privatedomain":
//                return "http://wordpress.m1book.com/yinsi-llzs";
//            case "com.idostudy.gushi":
//                return "http://wordpress.m1book.com/yinsi-gsczj";
//            case "com.story.chengyu":
//                return "http://wordpress.m1book.com/yinsi-dhw";
//            case "com.idostudy.errorbook":
//                return "http://wordpress.m1book.com/ctb-yinsi";
//            case "com.neihan.clock":
//                return "http://wordpress.m1book.com/隐私声明-61";
//	        case "com.idotools.magnifier":
//                return "http://wordpress.m1book.com/yinsi-fdj";
//            case "com.koudai.qrcode":
//                return "http://wordpress.m1book.com/隐私声明-46";
//            default:
//                return "";
//        }
//    }
}
